package C7_2_MoveField;

import org.junit.Test;

/**
 * 搬移字段
 */
public class Account {
    private AccountType _type;
    private double _interestRate;

    /**
     * 重构前
     */
    double interestForAmount_days(double amount, int days) {
        return _interestRate * amount * days / 365;
    }

    /**
     * 重构后2
     */
    double interestForAmount_days2(double amount, int days) {
        return _type.getInterestRate() * amount * days / 365;
    }

}
